package com.yonyou.sto.modules.ums.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.sto.common.api.CommonPage;
import com.yonyou.sto.common.api.CommonResult;
import com.yonyou.sto.common.domain.DownloadFile;
import com.yonyou.sto.modules.ims.model.ImsParty;
import com.yonyou.sto.modules.ums.model.UmsNcCustomer;
import com.yonyou.sto.modules.ums.service.UmsNcCustomerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author aegon
 * @since 2022-11-25
 */
@RestController
@RequestMapping("/server/ums/umsNcCustomer")
public class UmsNcCustomerController {

    @Autowired
    private UmsNcCustomerService umsNcCustomerService;

    @ApiOperation(value = "根据付款单位分页查询客户信息")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<UmsNcCustomer>> list(@RequestParam(value = "keyword", required = false) String keyword,
                                                   @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
                                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        Page<UmsNcCustomer> partyPage = umsNcCustomerService.list(keyword, pageSize, pageNum);
        return CommonResult.success(CommonPage.restPage(partyPage));
    }

    /**
     * 查询客户名称
     */
    @ApiOperation(value = "查询客户名称列表供用户选择")
    @RequestMapping(value = "/nameList",method = RequestMethod.GET)
    public CommonResult<List<String>> nameList(){
        List<String> names = umsNcCustomerService.getnames();
        return CommonResult.success(names);
    }



}

